package biz.obake.team.touchprotector.ui;

import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import biz.obake.team.touchprotector.R;
import biz.obake.team.touchprotector.c;
import biz.obake.team.touchprotector.features.upsidedown.b;
import biz.obake.team.touchprotector.g.a;

public class Tab_UpsideDown extends a {
    public void onCreatePreferences(Bundle bundle, String str) {
        setPreferencesFromResource(R.xml.ui_tab_upsidedown, str);
        if (b.f()) {
            prefRemove("sensor_unavailable");
            return;
        }
        PreferenceScreen preferenceScreen = getPreferenceScreen();
        for (int L0 = preferenceScreen.L0() - 1; L0 >= 0; L0--) {
            Preference K0 = preferenceScreen.K0(L0);
            if (!"sensor_unavailable".equals(K0.o())) {
                preferenceScreen.O0(K0);
            }
        }
    }

    /* access modifiers changed from: protected */
    public void onPrefChanged(SharedPreferences sharedPreferences, String str) {
        if (str.equals("lock_upside_down") && !a.g("lock_upside_down")) {
            prefSwitch("unlock_right_side_up", false);
        }
        if (str.equals("unlock_right_side_up") && a.g("unlock_right_side_up")) {
            prefSwitch("lock_upside_down", true);
        }
    }

    /* access modifiers changed from: protected */
    public void onUpdateDisplay() {
        Preference H0 = getPreferenceScreen().H0("upside_down_sensitivity");
        if (H0 != null) {
            H0.v0(c.w(R.string.pref_upside_down_sensitivity_summary).replace("{0}", Integer.toString(a.j("upside_down_sensitivity"))).replace("{1}", Integer.toString(a.j("right_side_up_sensitivity"))));
        }
    }
}
